/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package freechoicepn.datamodel;

import java.util.ArrayList;

/**
 *
 * @author Tomas
 * 
 * Trieda reprezentujuca miesta
 */
public class Place implements Comparable<Place> {
    
    private int id; 
    private String label;   // nazov miesta
    private int tokens;     // pocet tokenov
    private boolean isStatic;   // true ak je miesto staticke
    private ArrayList<Transition> outTransitions;

    public Place(int id, String label, int tokens, boolean isStatic) {
        this.id = id;
        this.label = label;
        this.tokens = tokens;
        this.isStatic = isStatic;
        this.outTransitions = new ArrayList();
    }
    
    public void addOutTransition(Transition t) {
        this.outTransitions.add(t);
    }

    @Override
    public String toString() {
        return "id: " + id + " label: " + label + " tokens: " + tokens + " isStatic: " + isStatic + "\n";
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Place) {
            Place place = (Place)obj;
            
            if (place.getId() == this.id) {
                return true;
            }
        }
        
        return false;
    }
    
    @Override
    public int compareTo(Place p) {
        return this.id - p.getId();
    }
    
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getLabel() {
        return label;
    }
    
    public ArrayList<Transition> getOutTransitions() {
        return outTransitions;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public int getTokens() {
        return tokens;
    }

    public void setTokens(int tokens) {
        this.tokens = tokens;
    }

    public boolean isIsStatic() {
        return isStatic;
    }

    public void setIsStatic(boolean isStatic) {
        this.isStatic = isStatic;
    }
}